﻿/*
#------------------------------------------------------------------------------
#-- Program Name:	[dbo].[spMSX_msx_servers_nogroup]
#-- Purpose:		Retrieve the servers that do not belong to an MSX group
#--	Last Update:	09/17/2012
#--					For a complete history - please review comments in Version
#--					Control.
#------------------------------------------------------------------------------
*/
CREATE PROCEDURE [dbo].[spMSX_msx_servers_nogroup]
AS

SET NOCOUNT ON

SELECT		NULL servergroup_id,
			ts.server_id,
			ts.server_name,
			ts.enlist_date,
			ts.last_poll_date
FROM		[msdb].[dbo].[systargetservers] ts 
LEFT JOIN	[msdb].[dbo].[systargetservergroupmembers] tsgm ON tsgm.server_id = ts.server_id
WHERE		tsgm.server_id IS NULL

SET NOCOUNT OFF